﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using GSMock.Config;

namespace GSMock.UnitTests
{
    [TestClass]
    public class ConfigurationTests
    {
        private Config.Configuration configuration;

        public Config.Configuration Configuration
        {
            get
            {
                if (this.configuration == null)
                {
                    this.configuration = Config.Configuration.GetConfig();
                }

                return this.configuration;
            }
            set
            {
                this.configuration = value;
            }
        }
        
        [TestMethod]
        public void ReadConfigurationTest()
        {
            Assert.IsNotNull(this.Configuration);
        }

        [TestMethod]
        public void IntCollectionIndexerTest()
        {
            Config.Configuration config = Config.Configuration.GetConfig();
            Assert.AreEqual(config.Collections[0].Name, "news");
        }

        [TestMethod]
        public void StringCollectionIndexerTest()
        {
            Config.Configuration config = Config.Configuration.GetConfig();
            Assert.AreEqual(config.Collections["books"].Name, "books");
        }
    }
}
